gdk_device_has_bidi_layouts
<SUBSECTION>
-gdk_device_get_state
gdk_device_get_surface_at_position
GdkTimeCoord
gdk_device_get_axis
#include "gdksurfaceprivate.h"
#include "gdkprivate-broadway.h"
-static void gdk_broadway_device_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask);
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
- device_class->get_state = gdk_broadway_device_get_state;
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
device_class->query_state = gdk_broadway_device_query_state;
device_class->grab = gdk_broadway_device_grab;
_gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
}
-static void
-gdk_broadway_device_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask)
-{
- double x, y;
-
- gdk_surface_get_device_position (surface, device, &x, &y, mask);
-
- if (axes)
- {
- axes[0] = x;
- axes[1] = y;
- }
-}
-
static void
gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
}
}
-/**
- * gdk_device_get_state: (skip)
- * @device: a #GdkDevice.
- * @surface: a #GdkSurface.
- * @axes: (nullable) (array): an array of doubles to store the values of
- * the axes of @device in, or %NULL.
- * @mask: (optional) (out): location to store the modifiers, or %NULL.
- *
- * Gets the current state of a pointer device relative to @surface. As a
- * physical device’s coordinates are those of its logical pointer, this
- * function may not be called on devices of type %GDK_DEVICE_TYPE_PHYSICAL,
- * unless there is an ongoing grab on them.
- *
- * See also: gdk_seat_grab().
- */
-void
-gdk_device_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask)
-{
- g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
- g_return_if_fail (GDK_IS_SURFACE (surface));
- g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
- gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
-
- if (GDK_DEVICE_GET_CLASS (device)->get_state)
- GDK_DEVICE_GET_CLASS (device)->get_state (device, surface, axes, mask);
-}
-
/*
* gdk_device_get_position:
* @device: pointer device to query status about.
guint index_);
-GDK_AVAILABLE_IN_ALL
-void gdk_device_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
_gdk_display_device_grab_update (display, device, device, 0);
}
-static void
-gdk_macos_device_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask)
-{
- double x_pos, y_pos;
-
- g_assert (GDK_IS_MACOS_DEVICE (device));
- g_assert (GDK_IS_MACOS_SURFACE (surface));
-
- gdk_surface_get_device_position (surface, device, &x_pos, &y_pos, mask);
-
- if (axes != NULL)
- {
- axes[0] = x_pos;
- axes[1] = y_pos;
- }
-}
-
static void
gdk_macos_device_query_state (GdkDevice *device,
GdkSurface *surface,
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
- device_class->get_state = gdk_macos_device_get_state;
device_class->grab = gdk_macos_device_grab;
device_class->query_state = gdk_macos_device_query_state;
device_class->set_surface_cursor = gdk_macos_device_set_surface_cursor;
uint32_t state,
gboolean from_key_repeat);
-static void
-gdk_wayland_device_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask)
-{
- double x, y;
-
- gdk_surface_get_device_position (surface, device, &x, &y, mask);
-
- if (axes)
- {
- axes[0] = x;
- axes[1] = y;
- }
-}
-
static void
gdk_wayland_pointer_stop_cursor_animation (GdkWaylandPointerData *pointer)
{
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
- device_class->get_state = gdk_wayland_device_get_state;
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor;
device_class->query_state = gdk_wayland_device_query_state;
device_class->grab = gdk_wayland_device_grab;
g_signal_emit_by_name (G_OBJECT (device), "changed");
}
-static void
-gdk_device_virtual_get_state (GdkDevice *device,
- GdkSurface *window,
- double *axes,
- GdkModifierType *mask)
-{
- GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
- GdkDevice *active = virtual->active_device;
-
- GDK_DEVICE_GET_CLASS (active)->get_state (active,
- window, axes, mask);
-}
-
static void
gdk_device_virtual_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
- device_class->get_state = gdk_device_virtual_get_state;
device_class->set_surface_cursor = gdk_device_virtual_set_surface_cursor;
device_class->query_state = gdk_device_virtual_query_state;
device_class->grab = gdk_device_virtual_grab;
G_DEFINE_TYPE (GdkDeviceWin32, gdk_device_win32, GDK_TYPE_DEVICE)
-static void
-gdk_device_win32_get_state (GdkDevice *device,
- GdkSurface *window,
- double *axes,
- GdkModifierType *mask)
-{
- double x, y;
-
- gdk_surface_get_device_position (window, device, &x, &y, mask);
-
- if (axes)
- {
- axes[0] = round (x);
- axes[1] = round (y);
- }
-}
-
static void
gdk_device_win32_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
- device_class->get_state = gdk_device_win32_get_state;
device_class->set_surface_cursor = gdk_device_win32_set_surface_cursor;
device_class->query_state = gdk_device_win32_query_state;
device_class->grab = gdk_device_win32_grab;
return mask;
}
-static void
-gdk_device_wintab_get_state (GdkDevice *device,
- GdkSurface *window,
- double *axes,
- GdkModifierType *mask)
-{
- GdkDeviceWintab *device_wintab;
-
- device_wintab = GDK_DEVICE_WINTAB (device);
-
- /* For now just use the last known button and axis state of the device.
- * Since graphical tablets send an insane amount of motion events each
- * second, the info should be fairly up to date */
- if (mask)
- {
- *mask = get_current_mask ();
- *mask &= 0xFF; /* Mask away core pointer buttons */
- *mask |= ((device_wintab->button_state << 8)
- & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
- | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
- | GDK_BUTTON5_MASK));
- }
-
- if (axes && device_wintab->last_axis_data)
- _gdk_device_wintab_translate_axes (device_wintab, window, axes, NULL, NULL);
-}
-
static void
gdk_device_wintab_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
- device_class->get_state = gdk_device_wintab_get_state;
device_class->set_surface_cursor = gdk_device_wintab_set_surface_cursor;
device_class->query_state = gdk_device_wintab_query_state;
device_class->grab = gdk_device_wintab_grab;
const GValue *value,
GParamSpec *pspec);
-static void gdk_x11_device_xi2_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask);
static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
object_class->get_property = gdk_x11_device_xi2_get_property;
object_class->set_property = gdk_x11_device_xi2_set_property;
- device_class->get_state = gdk_x11_device_xi2_get_state;
device_class->set_surface_cursor = gdk_x11_device_xi2_set_surface_cursor;
device_class->query_state = gdk_x11_device_xi2_query_state;
device_class->grab = gdk_x11_device_xi2_grab;
}
}
-static void
-gdk_x11_device_xi2_get_state (GdkDevice *device,
- GdkSurface *surface,
- double *axes,
- GdkModifierType *mask)
-{
- GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
-
- if (axes)
- {
- GdkDisplay *display;
- XIDeviceInfo *info;
- int i, j, ndevices;
- Screen *xscreen;
-
- display = gdk_device_get_display (device);
- xscreen = GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen)->xscreen;
-
- gdk_x11_display_error_trap_push (display);
- info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display),
- device_xi2->device_id, &ndevices);
- gdk_x11_display_error_trap_pop_ignored (display);
-
- for (i = 0, j = 0; info && i < info->num_classes; i++)
- {
- XIAnyClassInfo *class_info = info->classes[i];
- GdkAxisUse use;
- double value;
-
- if (class_info->type != XIValuatorClass)
- continue;
-
- value = ((XIValuatorClassInfo *) class_info)->value;
- use = gdk_device_get_axis_use (device, j);
-
- switch ((guint) use)
- {
- case GDK_AXIS_X:
- case GDK_AXIS_Y:
- case GDK_AXIS_IGNORE:
- {
- int root_x, root_y;
-
- /* FIXME: Maybe root coords caching should happen here */
- gdk_surface_get_origin (surface, &root_x, &root_y);
- _gdk_device_translate_screen_coord (device, surface,
- root_x, root_y,
- WidthOfScreen (xscreen),
- HeightOfScreen (xscreen),
- j, value,
- &axes[j]);
- }
- break;
- default:
- _gdk_device_translate_axis (device, j, value, &axes[j]);
- break;
- }
-
- j++;
- }
-
- if (info)
- XIFreeDeviceInfo (info);
- }
-
- if (mask)
- gdk_x11_device_xi2_query_state (device, surface,
- NULL,
- NULL, NULL,
- mask);
-}
-
static void
gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,